﻿@model IEnumerable<MVCApp.Models.Person>

@if (Model != null && Model.Count() != 0)
{
    <p>
        Found: @Model.Count()
    </p>
    <table>
        <tr>
            <th></th>
            <th>@Html.LabelFor(p => Model.First().Name)
            </th>
            <th>@Html.LabelFor(p => Model.First().Lastname)
            </th>
            <th>@Html.LabelFor(p => Model.First().StreetAddress)
            </th>
            <th>@Html.LabelFor(p => Model.First().District.PostCode)
            </th>
            <th>@Html.LabelFor(p => Model.First().TelephoneNumber)
            </th>
            <th>@Html.LabelFor(p => Model.First().Notes)
            </th>
        </tr>
        @foreach (var person in Model)
        { 
            <tr>
                <td>
                    <input type="checkbox" name="selectedPersons" value="@person.Id" />
                </td>
                <td>
                    @Html.DisplayFor(modelItem => person.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => person.Lastname)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => person.StreetAddress)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => person.District.PostCode)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => person.TelephoneNumber)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => person.Notes)
                </td>
                <td>
                    @Html.ActionLink("Edit", "Edit", "Person", new { id = person.Id }, null)
                </td>
            </tr>
        }
    </table>
}

